package cn.walls1717.service.impl;

import cn.walls1717.domain.Product;
import cn.walls1717.mapper.ProductMapper;
import cn.walls1717.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author CJ
 * @date 2020/8/2
 */
@Service
@Transactional(rollbackFor=Exception.class)
public class ProductServiceImpl implements ProductService {


    private ProductMapper productMapper;

    @Autowired
    public void setProductMapper(ProductMapper productMapper) {
        this.productMapper = productMapper;
    }

    @Override
    public List<Product> findAll() throws Exception {
        return productMapper.findAll();
    }

    @Override
    public void save(Product product) throws Exception {
        productMapper.save(product);
    }
}
